<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>帧动画——animation</title>
    <style type="text/css">
        html {
            background: #f5f5f5;
        }

        h2 {
            padding: 5px 0 0 10px;
            color: #ccc;
        }

        .box {
            width: 600px;
            border: 1px solid #ccc;
            background: #fff;
            margin: 20px auto;
        }

        @keyframes circleRun {
            from {
                transform: translate(150px, 75px);
            }
            to {
                transform: translate(550px, 0);
                background: red;
            }
        }

        .circle {
            width: 50px;
            height: 50px;
            background: blue;
            border-radius: 50%;
            margin: 20px 0 75px;
            animation: circleRun 1s ease paused;
        }

        .box:hover .circle {
            animation-play-state: running;
        }

        .circle--forwards {
            animation-fill-mode: forwards;
        }

        .circle--delay {
            animation-delay: 0.5s;
        }

        .circle--delay-backwards {
            animation-delay: 0.5s;
            animation-fill-mode: backwards;
        }

        .circle--both {
            animation-fill-mode: both;
        }
    </style>
</head>
<body>
    <div class="box">
        <h2>none</h2>
        <div class="circle"></div>

        <h2>forwards</h2>
        <div class="circle circle--forwards"></div>

        <h2>backwards</h2>
        <div class="circle circle--delay"></div>
        <div class="circle circle--delay-backwards"></div>

        <h2>both</h2>
        <div class="circle circle--both"></div>
    </div>
</body>
</html>